7 Star 2 Fork 2

佰钧成开源官方组织 / hdc-join-wifi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

hdc-join-wifi

A simple app for making it possible to join a certain wifi access point from HDC without requiring a rooted device. Also supports modifying proxy settings.

Since there is no way to start Ability by hdc command in HarmonyOS as adb in Android OS, it is currently only support for hard coding to join a wifi accesspoint. Modification of proxy setting are not supported neither. We will complete it as soon as HarmonyOS updating its sdk or supply corresponding mechanism.

Preview

Usage

install the app:

hdc app install build/outputs/hap/debug/phone/entry-debug-unsigned.hap

Use the Ability Manager to start the application with the appropriate parameters: (HarmonyOS does not support to start Ability with parameters by HDC, so the following commands can only be used after HarmonyOS supports them.)

To join a wifi network with no password such as:

 hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID

To join a password protected wifi network such as:

hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID -e password_type WEP|WPA -e password PASSWORD

To join a wifi network and set a static proxy (with optional bypass list) such as:

hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility  -e ssid SSID -e password_type WEP|WPA -e password PASSWORD -e proxy_host HOSTNAME -e proxy_port PORT [-e proxy_bypass COMMA,SEPARATED,LIST]

To join a wifi network and set a proxy auto-configuration URL:

hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID -e password_type WEP|WPA -e password PASSWORD -e proxy_pac_uri http://my.pac/url

To clear proxy settings, simply join the same network again and do not pass proxy arguments.

Device manager is not supported in harmony OS, so the following commands are not supported temporarily:

To get around this for testing purposes and modify any wifi configuration, you can grant this hap device owner privileges such as:

hdc shell dpm set-device-owner "com.steinwurf.hdcjoinwifi/.AdminReceiver"

This requires that your device has no provisioned accounts on it. If you wish to demote this app and remove its device owner privileges, run this:

hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e clear_device_admin true

Use hard coding to set the appropriate parameters to start the application:

in the MainAbility.java:

mSSID = "test";
mPasswordType = "WPA";
mPassword = "12345678";

You can change these wifi accesspoint parameters to make sure you are connected to a cetain hotspot.

License

hdc-join-wifi is available under the BSD license.

Copyright (c) 2016, Steinwurf ApS All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of adb-join-wifi nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

HarmonyOS连接wifi热点的样例 展开 收起
Java
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/baijuncheng-open-source/hdc-join-wifi.git
git@gitee.com:baijuncheng-open-source/hdc-join-wifi.git
baijuncheng-open-source
hdc-join-wifi
hdc-join-wifi
master

搜索帮助